package com.cn.xiaonuo.slbfinances.slbreward.controller;

import com.cn.xiaonuo.common.entity.BusinessMessage;
import com.cn.xiaonuo.common.utils.ApiJsonModel;
import com.cn.xiaonuo.slbfinances.slbreward.service.ICoveragePrizeService;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
public class CoveragePrizeController {
    @Resource
    private ICoveragePrizeService coveragePrizeService;

    @ApiOperation(value = "转盘抽奖查询--中奖用户列表查询", notes = "转盘抽奖查询--中奖用户列表查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "userId", value = "用户id（String）"),
            @ApiImplicitParam(name = "phone", value = "电话（String）"),
            @ApiImplicitParam(name = "beginTime", value = "开始时间，传时间戳（String）"),
            @ApiImplicitParam(name = "endTime", value = "结束时间，传时间戳（String）"),
            @ApiImplicitParam(name = "prizeGrade", value = "奖品等级，1一等奖，2二等奖，3三等奖（String）"),
            @ApiImplicitParam(name = "useState", value = "使用状态，0未使用，1已经使用（String）"),
            @ApiImplicitParam(name = "pageNo", value = "第几页（Integer）", required = true),
            @ApiImplicitParam(name = "pageSize", value = "每页长度（Integer）", required = true)
    })
    @RequestMapping(value = "/api/coverageprize/myPrizeLog", method = RequestMethod.POST)
    public BusinessMessage myPrizeLog(String userId, String phone, String beginTime, String endTime, String prizeGrade, String useState, Integer pageNo, Integer pageSize){
        return coveragePrizeService.myPrizeLog(userId,phone,beginTime,endTime,prizeGrade,useState,pageNo,pageSize);
    }


    @ApiOperation(value = "转盘抽奖设置--抽奖规则设置修改", notes = "转盘抽奖设置--抽奖规则设置修改")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "loginUserId", value = "登录用户ID（String）", required = true),
            @ApiImplicitParam(name = "prizeId", value = "奖品ID（String）", required = true),
            @ApiImplicitParam(name = "prizeGrade", value = "奖品等级，1一等奖，2二等奖，3三等奖（String）", required = true),
            @ApiImplicitParam(name = "prizeName", value = "奖品名称（String）", required = true),
            @ApiImplicitParam(name = "prizeWeight", value = "中奖概率，只能传整数（String）", required = true),
            @ApiImplicitParam(name = "prizeAmount", value = "奖品数量，只能传整数（String）", required = true)
    })
    @RequestMapping(value = "/api/coverageprize/updateprize", method = RequestMethod.POST)
    public BusinessMessage updatePrize(String loginUserId,String prizeId,String prizeGrade,String prizeName,String prizeWeight,String prizeAmount){
        return coveragePrizeService.updatePrize(loginUserId,prizeId,prizeGrade,prizeName,prizeWeight,prizeAmount);
    }

    @ApiOperation(value = "转盘抽奖设置--抽奖规则配置修改", notes = "转盘抽奖设置--抽奖规则配置修改")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "loginUserId", value = "登录用户ID（String）", example = "10086",required = true),
            @ApiImplicitParam(name = "configId", value = "配置項ID", example = "TEST",required = true),
            @ApiImplicitParam(name = "configValue", value = "配置值", example = "20086",required = true)
    })
    @RequestMapping(value = "/api/coverageprize/updatePrizeConfig", method = RequestMethod.POST)
    public BusinessMessage updatePrizeConfig(String loginUserId,String configId,String configValue){
        return coveragePrizeService.updatePrizeConfig(loginUserId,configId,configValue);
    }

    @ApiOperation(value = "转盘抽奖设置--抽奖规则列表", notes = "转盘抽奖设置--抽奖规则列表")
    @RequestMapping(value = "/api/coverageprize/queryPrize", method = RequestMethod.POST)
    public BusinessMessage queryPrize(){
        return coveragePrizeService.queryPrize();
    }

    @ApiOperation(value = "转盘抽奖设置--抽奖规则配置", notes = "转盘抽奖设置--抽奖规则配置")
    @RequestMapping(value = "/api/coverageprize/queryPrizeConfig", method = RequestMethod.POST)
    public BusinessMessage queryPrizeConfig(){
        return coveragePrizeService.queryPrizeConfig();
    }
}
